package com.doctor.adapter;

import java.util.List;

import com.doctor.ui.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * 医师微信群适配器
 */
public class WXGroupAdapter extends BaseAdapter{
	
	private Context context;
	private List<String> data;
	
	public WXGroupAdapter(Context context, List<String> data) {
		this.context = context;
		this.data = data;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return data == null ? 0 : data.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return data.get(arg0);
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return arg0;
	}

	@Override
	public View getView(int arg0, View arg1, ViewGroup arg2) {
		// TODO Auto-generated method stub
		ViewHolder holder;
		if (arg1 == null) {
			holder = new ViewHolder();
			arg1 = View.inflate(context, R.layout.wx_group_item, null);
			holder.tvName = (TextView) arg1;
			arg1.setTag(holder);
		} else {
			holder = (ViewHolder) arg1.getTag();
		}
		
		holder.tvName.setText(getItem(arg0).toString());
		
		return arg1;
	}
	
	

	private class ViewHolder {
		TextView tvName;
	}
}
